<?php

namespace backend\controllers;



use backend\assets\BaseController;
use PHPUnit\Framework\Exception;
use post\modules\post\models\Post;
use post\modules\post\models\Zan;
use Yii;
use yii\web\Controller;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use common\models\LoginForm;



class IndexController extends BaseController {
	
	// 查询本人的所有收货地址
	public function actionTest() {


//	    $post=Zan::find()->asArray()->all();
        $json=Zan::find()->asArray()->count();
//	    var_dump($zhi);
//        $source = Yii::$app->redis->set('post',$zhi);
        return $this->jsonSuccess($json);
	}

	public function actionAdd()
    {
         $zan=new Zan();
         $zan->user_id=1;
         $zan->post_id=2;

         $isok=$zan->save();
         return $this->jsonSuccess($isok);
    }

    public function  actionGet()
    {

        try{
            $source = Yii::$app->redis->get('post');
            var_dump($source);
        }catch (\yii\base\Exception $exception)
        {
            var_dump($exception->getName());
            var_dump("Redis链接有问题");
        }

    }

}
